package com.chatty.compose.ui.components

import android.R
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Text
import androidx.compose.material.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp


@Composable
fun IconTextButton() {
    Button(
        onClick = { /* 点击事件处理 */ },
        modifier = Modifier.padding(8.dp),
        shape = RoundedCornerShape(8.dp),
        colors = ButtonDefaults.buttonColors(
            backgroundColor = Color.Blue
        )
    ) {

            // 这里使用一个示例图标，你可以替换为你自己的图标资源
            Image(
                painter = painterResource(id = R.drawable.ic_menu_add),
                contentDescription = null,
                modifier = Modifier.padding(end = 8.dp)
            )
            Text(text = "带有图标的按钮", color = Color.White)
    }
}
@Composable
fun StyledTextButton() {
    TextButton(
        onClick = { /* 处理点击事件 */ },
        modifier = Modifier.padding(16.dp),
        colors = ButtonDefaults.textButtonColors(
            contentColor = Color.Red,
            backgroundColor = Color.LightGray.copy(alpha = 0.2f),
            disabledContentColor = Color.Gray
        )
    ) {
        Text(
            text = "自定义样式文本按钮",
            fontWeight = FontWeight.Bold
        )
    }
}







@Preview
@Composable
fun IconTextButtonPreview() {
   // IconTextButton()
    StyledTextButton()
}